import request from "@/utils/request";
// 微信小程序查询对象
export interface WxProgramQuery {
  /** 搜索关键字 */
  keywords?: string;
  pageSize?: number;
  current: number;
}
/** 微信小程序数据分页对象 */
export interface WxProgramVO {
  id: number;
  appId: string;
  appSecret: string;
  description: string;
  userAgreement: string;
  privacyPolicy: string;
  aboutUs: string;
  createdAt: string;
  updatedAt: string;
}
/** 微信小程序表单对象 */
export interface WxProgramForm {
  id?: number;
  appId: string;
  appSecret: string;
  description: string;
  userAgreement: string;
  privacyPolicy: string;
  aboutUs: string;
}
class wxprogramAPI {
  /** 获取微信小程序信息 */
  static getWxProgram() {
    return request<any, WxProgramVO[]>({
      url: "/api/wx-program",
      method: "get",
      // data: params,
    });
  }
  /** 根据ID获取微信小程序信息 */
  static getWxProgramById(id: number) {
    return request<any, WxProgramVO>({
      url: `/api/wx-program/${id}`,
      method: "get",
      // data: params,
    });
  }
  /** 创建或更新微信小程序信息 */
  static updateWxProgram(params: WxProgramForm) {
    return request<any, WxProgramVO>({
      url: "/api/wx-program",
      method: "post",
      data: params,
    });
  }
  /** 删除微信小程序信息 */
  static deleteWxProgram(id: string) {
    return request({
      url: `/api/wx-program/${id}`,
      method: "delete",
      // data: params,
    });
  }
}

export default wxprogramAPI;
